home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr25
/
rxansi.zip
/
RXANSI.DOC
< prev
Wrap
Text File
|
1993-03-16
|
15KB
|
412 lines
RXANSI - Rexx eXtension for ANSI
Version 1.2
Steve Mullarkey
3rd.April 1991
NOTICE
RXANSI is distributed as Shareware. This means that if you find
the product useful you must pay for it. Continued use of the
product after any evaluation period is only allowed once payment
has been received.
To register RXANSI, send £15.00 to the following address ;
95 Greenville Drive,
Low Moor,
Bradford,
West Yorkshire,
England.
BD12 0PT.
In return you will get the latest version on either 5.25" or
3.5" disk plus you will be sent the next new release.
NB This price is for the UK only.
The latest version is available from the following BBS's ;
The Mainframe BBS - (0274) 602788
TJD support BBS - (0535) 665345
As with all good software, you use this at your own risk. If
you have any problems leave a message on my BBS and I'll try and
help but I will not be responsible for any problems caused etc.
Description.
RXANSI is a REXX extension for OS/2 1.2 EE and OS/2 1.3 SE. It was
developed due to the lack of power available in REXX to perform
screen I/O.
Native REXX has two commands available, namely 'SAY', which displays
a line of text followed by a CR/LF, and PULL, which displays a
blank line then a question mark before accepting user input. These
two commands tend to make REXX procedures look unprofessional.
The RXANSI extensions provide the following ;
o Move cursor to any point on the screen
o Display text without the CR/LF
o Get keystrokes a key at a time (including function keys,
Home, Insert etc)
o Get input from a field of a give size.
o Change forground and background colours.
o Draw lines and Boxes
o Display Horizontal and vertical menus
o Do all of the above in local and/or remote
o Provide basic mouse support
Installation.
To install RXANSI copy RXANSI.DLL to any directory on your LIBPATH.
Demonstration.
After the DLL has been put in a suitable directory, run RXANSI.CMD.
This briefly demonstrates what is available with the package.
Function Use.
RXANSI consists of the following functions ;
o RxAnsiInit()
Enable use of ANSI screen controls
o RxGoTo(x,y)
Position cursor at point x,y on the screen
o RxGetChar()
Return the next keyboard character
o RxGetChars()
Get input from a field of a given size.
o RxPutChars(x)
Display characters x at the current cursor position without a CR/LF.
o RxLine(x1,y1,x2,y2,n)
Draw a line from (x1,y1) to (x2,y2), with optional joining
characters every n bytes.
o RxBox(x1,y1,x2,y2,Fill)
Draw a box with (x1,y1) at the top right and (x2,y2) at the
bottom left and optionally fill with the current background colour.
o RxHMenu(x1,y1,options)
Draw a menu bar horizontally across the screen
o RxVMenu(x1,y1,options)
Draw a menu bar vertically down the screen
o RxMode(mode,handle)
Select between local and/or remote modes
o RxLineType(V,H)
Select either single or double lines for both horizontal and
vertical lines.
o RxMouse( < ON | OFF > )
Activate or deactivate mouse support.
Before any function can be used it must be registered with the REXX
interpreter. this is done by the following calls ;
CALL RxFuncAdd 'RxAnsiInit','RXANSI','RxAnsiInit'
CALL RxFuncAdd 'RxGoTo', 'RXANSI','RxGoTo'
etc.
This need only be done once as it is a global definition.
After you have used the functions and before you exit the
procedure, you can de-register the functions as follows ;
CALL RxFuncDrop 'RxAnsiInit'
CALL RxFuncDrop 'RxGoTo'
etc
This is only required if you want to move or delete the DLL.
If you do drop the function definitions, they will be dropped for
all processes, not just the one issuing the delete.
Function Descriptions.
Name : RxAnsiInit()
Returns : OK if all OK
Function : This function sets variables in the REXX variable pool
to enable the following functions ;
Foreground colour Background colour
White On_White
Red On_Red
Cyan On_Cyan
Blue On_Blue
Magenta On_Magenta
Green On_Green
Yellow On_Yellow
Black On_Black
The following commands are also provided ;
CLS - clear the screen
HOME - move cursor to topp of screen
SAVECUR - save current cursor position
RESTCUR - restore cursor position from previous SAVECUR
BLINK - set subsequent text to blink
INTENSE - set text to intense
INVERSE - set text to inverse display
RESET - set everything back to normal
Example : rc = RxAnsiInit()
SAY cls Red On_Black 'Hello World'
This would initialise ANSI support then the second
line would clear the screen and display the message
'Hello world' in red on a black background.
--------------------------------------------------------------------------
Name : RxGoTo(x,y)
Returns : OK if all OK
Function : This function moves the cursor to line x and column y.
Example : rc = RxGoTo(10,30)
This would place the cursor in the middle of the screen.
--------------------------------------------------------------------------
Name : RxGetChar()
Returns : Character value of next keystroke.
Function : This function waits for the next keystroke.
If a non-display key is hit the following could be
returned in local mode ;
F1-F12, ENTER, ESCAPE, DELETE, INSERT, HOME, END,
PAGEUP, PAGEDOWN, LEFT, RIGHT, UP, DOWN, BACKSPACE
or ERROR for anything else.
In remote mode, the following can be returned ;
LEFT, RIGHT, UP, DOWN, ESCAPE, ENTER, HOME & END
Example : ch = RxGetChar()
This would place the value of the next key hit in
variable ch.
--------------------------------------------------------------------------
Name : RxGetChars(x1,y1,n,<default>)
Returns : User input and sets variable 'LASTKEY' to last key hit.
Function : This function displays a line at X1,Y1 for 'n' bytes in
the current background colour. Data may be entered in
the field upto the defined size. Basic editing keys are
also available. Once either ENTER or ESCAPE is hit, the
text entered is returned by the function and the
variable 'LASTKEY' is set to either ESCAPE or ENTER.
Example : ch = RxGetChars(4,10,20,'TEST.CMD')
This would display an input field of 20 bytes at line 4,
column 10 with the default value of TEST.CMD. This could
be edited and whatever is on the screen when either enter
or escape is hit will be returned.
--------------------------------------------------------------------------
Name : RxGetChar()
Returns : Character value of next keystroke.
Function : This function waits for the next keystroke.
If a non-display key is hit the following could be
returned in local mode ;
F1-F12, ENTER, ESCAPE, DELETE, INSERT, HOME, END,
PAGEUP, PAGEDOWN, LEFT, RIGHT, UP, DOWN, BACKSPACE
or ERROR for anything else.
If mouse support is enabled, the following can also
be returned in local mode ;
BUTTON_1, BUTTON_2.
In remote mode, the following can be returned ;
LEFT, RIGHT, UP, DOWN, ESCAPE, ENTER, HOME & END
Example : ch = RxGetChar()
This would place the value of the next key hit in
variable ch.
--------------------------------------------------------------------------
Name : RxPutChars(x)
Returns : OK if all OK.
Function : This function displays the text x at the current cursor
location. A CR/LF is not added to the end.
Example : rc = RxPutChars('Hello World')
This would display 'Hello world' at the current cursor
location.
--------------------------------------------------------------------------
Name : RxLine(x1,y1,x2,y2,<n>)
Returns : OK if all OK.
Function : This function draws a line between (x1,y1) and (x2,y2).
The fifth parameter is optional, and will provide a
joining character every 'n' bytes.
Example : rc = RxLine(1,1,1,80,10)
This would display a line across the top of the screen,
with a joining character every 10 bytes.
--------------------------------------------------------------------------
Name : RxBox(x1,y1,x2,y2,<Fill>)
Returns : OK if all OK.
Function : This function draws a box with x1,y1 as the top, right
hand corner and x2,y2 the bottom,left hand corner. The
optional fifth parameter will fill the box with the
current background colour.
Example : rc = RxBox(1,1,25,80)
This would draw a box round the edge of the screen.
--------------------------------------------------------------------------
Name : RxLineType(V,H)
Returns : OK if all OK.
Function : This function changes the characters used for drawing
lines. Possible values are 'S' for single and 'D' for
double. The first parameter is for Vertical lines and
the second for horizontal lines. Corners of boxes etc.
are also changed.
Example : rc = RxLineType(D,S)
This would make all vertical lines double and all
horizontal ones signle.
--------------------------------------------------------------------------
Name : RxMode(Mode,<handle>)
Returns : OK if all OK.
Function : This function changes all subsequent I/O to be either
local, if mode is 'LOCAL',remote if mode is 'REMOTE' or
MIXED, where input is from the remote and output is sent
to both the local and remote screens. For REMOTE and
MIXED, the file handle of the comm.port must be passed.
NB All I/O is done directly, so any programs used which
buffer I/O will cause the buffered characters to be lost.
This is necessary so cursor movement keystrokes etc.can be
picked up.
If the user hangs up while in remote mode, the variable
'LASTKEY' is set to 'USER GONE' and the next function
call which reads from the remote user will fail with a
syntax error. This is so you don't have to check each
return code for 'USER GONE', just put a statement such as ;
SIGNAL SYNTAX ON NAME USERGONE
at the start of your procedure, then when the user hangs
up, control will be passed to the label at 'USERGONE'.
Remember to check that the LASTUSER variable is set to
'USER GONE' to ensure it's not a coding bug in the REXX
procedure !
See the RXANSI.CMD for an example of how to do this.
If a user hangs up, RxANISIInit must be called before
any other function to reset the carrier watchdog code.
This will normally be done when the next user calls the
program.
Example : rc = RxMode(REMOTE,Commhndl)
This would direct all subsequent I/O to the file handle
in variable CommHndl.
--------------------------------------------------------------------------
Name : RxHMenu(x1,y1,Options)
Returns : Name of option chosen.
Function : This function displays a horizontal menu at location
x1,y1. Left and Right Cursor movement keys will
highlight the different options, any other key will exit.
The value of the key pressed is put in variable 'LASTKEY'.
Example : rc = RxHMenu(1,1,'Files','Messages','Bulletins',Doors')
This would display a menu across the top of the screen
consisting of four items.
--------------------------------------------------------------------------
Name : RxVMenu(x1,y1,Options)
Returns : Name of option chosen.
Function : This function displays a vertical menu at location
x1,y1. Up and Down Cursor movement keys will
highlight the different options, any other key will exit.
The value of the key pressed is put in variable 'LASTKEY'.
Example : rc = RxVMenu(2,3,'Area','Upload','Download')
This would display a menu down the screen consisting of
three items.
--------------------------------------------------------------------------
Name : RxMouse( state )
Returns : OK.
Function : This function turns mouse support on or off. This will
return the row and column on the mouse pointer when a
button was hit in variables MOUSE_X and MOUSE_Y and set
the variable LASTKEY to either BUTTON1 or BUTTON2.
If mouse support is on when a menu is displayed, the
mouse can be used to select an option. The left button
acts as escape, and the right one almost like enter. You
may highlight an option by clicking the right button once,
and select it by clicking again.
You should call RxMouse with a parm of OFF on exiting
the procedure, otherwise the mouse pointer could remain
on the screen.
Example : rc = RxMouse(ON)
This would display a mouse pointer in the centre of the
screen.
--------------------------------------------------------------------------
Revision History.
1.0 - Initial release.
1.1 - RxLine and RxBox commands added.
All function names prefixed with 'RX'.
1.2 - Local and remote added.
ANSI code generation optimised.
Menu support added.
More variables set during call to RxAnsiInit.
Field input added.
Mouse support added.
Suggestions.
Please send all queries or suggestions to the Mainframe BBS
(0274 - 602788).